Imports Castle.ActiveRecord
Imports Castle.ActiveRecord.ActiveRecordBase

Namespace Model

    ''' <summary>
    '''	Gerado por MyGeneration usando o template ActiveRecord Object Mapper-1.0.3
    '''	Criado em 14/08/2010 00:29:39
    ''' </summary>
    ''' <remarks></remarks>

    <Serializable(), ActiveRecord("produto")> _
    Public Class Produto
        Inherits ActiveRecordBase(Of Produto)

        Private _cd_produto As Integer

        Private _Grupo As Grupo
        Private _Unidade As Unidade
        Private _Ncm As Ncm

        Private _Mod_ICMS As Model.Tr_ICMS_Modalidade
        Private _cd_tr_icms_mod_icms As Integer ' Teste para vincular combo direto
        Private _Mod_ICMSST As Model.Tr_ICMS_Modalidade

        Private _SituacTribICMS As Model.Tr_Situac_Trib
        Private _SituacTribIPI As Model.Tr_Situac_Trib
        Private _SituacTribPIS As Model.Tr_Situac_Trib
        Private _SituacTribCOFINS As Model.Tr_Situac_Trib

        Private _ICMSOrigem As Model.Tr_ICMS_Origem

        Private _pr_nome As String
        Private _pr_fabricante As String
        Private _pr_barra As String

        Private _pr_custo As Decimal
        Private _pr_venda As Decimal

        Private _pr_inclusao As Date
        Private _pr_entrada As Date
        Private _pr_saida As Date
        Private _pr_inativo As Short

        Private _pr_peso_bruto As Decimal
        Private _pr_peso_liquido As Decimal

        Private _pr_foto As String
        Private _pr_observacao As String

        Private _pr_tipo As Short ' Pro ou Serv
        Private _pr_num_item As Short ' Veiculo, Mecamento, Arma

        Private _pr_aliq_ii As Decimal

        Private _pr_ipi_tipo_calc As Integer
        Private _pr_aliq_ipi As Decimal
        Private _pr_ipi_vlr_unit As Decimal

        Private _pr_pis_tipo_calc As Integer
        Private _pr_aliq_pis As Decimal
        Private _pr_pis_vlr_unit As Decimal

        Private _pr_pisst_tipo_calc As Integer
        Private _pr_aliq_pis_st As Decimal
        Private _pr_pisst_vlr_unit As Decimal

        Private _pr_cofins_tipo_calc As Integer
        Private _pr_aliq_cofins As Decimal
        Private _pr_cofins_vlr_unit As Decimal

        Private _pr_cofinsst_tipo_calc As Integer
        Private _pr_aliq_cofins_st As Decimal
        Private _pr_cofinsst_vlr_unit As Decimal

        Private _pr_aliq_icms_red As Decimal
        Private _pr_aliq_icms As Decimal
        Private _pr_aliq_icms_st_red As Decimal
        Private _pr_aliq_icms_st As Decimal

        Private _pr_aliq_issqn As Decimal
        Private _pr_cst As String

        Private _pr_perigoso As Short

        Private _pr_embalagem As String
        Private _pr_embalagem_quantidade As Decimal

        ' FK
        Private _Nfitems As IList(Of Nfitem) = New List(Of Model.Nfitem)
        Private _Estoques As IList(Of Estoque) = New List(Of Model.Estoque)

        <PrimaryKey(PrimaryKeyType.Sequence, SequenceName:="produto_cd_produto_seq")> _
        Public Property cd_produto() As Integer
            Get
                Return _cd_produto
            End Get
            Set(ByVal value As Integer)
                _cd_produto = value
            End Set
        End Property

        <BelongsTo("cd_grupo")> _
        Public Property Grupo() As Grupo
            Get
                Return _Grupo
            End Get
            Set(ByVal value As Grupo)
                _Grupo = value
            End Set
        End Property

        <BelongsTo("cd_unidade")> _
        Public Property Unidade() As Unidade
            Get
                Return _Unidade
            End Get
            Set(ByVal value As Unidade)
                _Unidade = value
            End Set
        End Property

        <BelongsTo("cd_ncm")> _
        Public Property Ncm() As Ncm
            Get
                Return _Ncm
            End Get
            Set(ByVal value As Ncm)
                _Ncm = value
            End Set
        End Property

        <BelongsTo("cd_tr_icms_mod_icms")> _
        Public Property Mod_ICMS() As Tr_ICMS_Modalidade
            Get
                '_cd_tr_icms_mod_icms = _Mod_ICMS.cd_tr_icms_mod
                Return _Mod_ICMS
            End Get
            Set(ByVal value As Tr_ICMS_Modalidade)
                _Mod_ICMS = value
                '_cd_tr_icms_mod_icms = _Mod_ICMS.cd_tr_icms_mod
            End Set
        End Property

        '<[Property](Access:=PropertyAccess.ReadOnly, Column:="cd_tr_icms_mod_icms", ColumnType:="Int32")> _
        <[Property]("cd_tr_icms_mod_icms", Insert:=False, Update:=False)> _
        Public Property cd_tr_icms_mod_icms() As Integer
            Get
                Return _cd_tr_icms_mod_icms
            End Get
            Set(ByVal value As Integer)
                _cd_tr_icms_mod_icms = value
            End Set
        End Property

        <BelongsTo("cd_tr_icms_mod_icmsst")> _
        Public Property Mod_ICMSST() As Tr_ICMS_Modalidade
            Get
                Return _Mod_ICMSST
            End Get
            Set(ByVal value As Tr_ICMS_Modalidade)
                _Mod_ICMSST = value
            End Set
        End Property

        <BelongsTo("cd_tr_situac_trib_icms")> _
        Public Property SituacTribICMS() As Model.Tr_Situac_Trib
            Get
                Return _SituacTribICMS
            End Get
            Set(ByVal value As Model.Tr_Situac_Trib)
                _SituacTribICMS = value
            End Set
        End Property
        <BelongsTo("cd_tr_situac_trib_ipi")> _
        Public Property SituacTribIPI() As Model.Tr_Situac_Trib
            Get
                Return _SituacTribIPI
            End Get
            Set(ByVal value As Model.Tr_Situac_Trib)
                _SituacTribIPI = value
            End Set
        End Property
        <BelongsTo("cd_tr_situac_trib_pis")> _
        Public Property SituacTribPIS() As Model.Tr_Situac_Trib
            Get
                Return _SituacTribPIS
            End Get
            Set(ByVal value As Model.Tr_Situac_Trib)
                _SituacTribPIS = value
            End Set
        End Property
        <BelongsTo("cd_tr_situac_trib_cofins")> _
        Public Property SituacTribCOFINS() As Model.Tr_Situac_Trib
            Get
                Return _SituacTribCOFINS
            End Get
            Set(ByVal value As Model.Tr_Situac_Trib)
                _SituacTribCOFINS = value
            End Set
        End Property

        <BelongsTo("cd_tr_icms_origem")> _
        Public Property ICMSOrigem() As Model.Tr_ICMS_Origem
            Get
                Return _ICMSOrigem
            End Get
            Set(ByVal value As Model.Tr_ICMS_Origem)
                _ICMSOrigem = value
            End Set
        End Property


        <[Property]("pr_nome")> _
        Public Property pr_nome() As String
            Get
                Return _pr_nome
            End Get
            Set(ByVal value As String)
                _pr_nome = value
            End Set
        End Property

        <[Property]("pr_fabricante")> _
        Public Property pr_fabricante() As String
            Get
                Return _pr_fabricante
            End Get
            Set(ByVal value As String)
                _pr_fabricante = value
            End Set
        End Property

        <[Property]("pr_barra")> _
        Public Property pr_barra() As String
            Get
                Return _pr_barra
            End Get
            Set(ByVal value As String)
                _pr_barra = value
            End Set
        End Property

        <[Property]("pr_custo")> _
        Public Property pr_custo() As Decimal
            Get
                Return _pr_custo
            End Get
            Set(ByVal value As Decimal)
                _pr_custo = value
            End Set
        End Property

        <[Property]("pr_venda")> _
        Public Property pr_venda() As Decimal
            Get
                Return _pr_venda
            End Get
            Set(ByVal value As Decimal)
                _pr_venda = value
            End Set
        End Property

        <[Property]("pr_inclusao", ColumnType:="Date")> _
        Public Property pr_inclusao() As Date
            Get
                Return _pr_inclusao
            End Get
            Set(ByVal value As Date)
                _pr_inclusao = value
            End Set
        End Property

        <[Property]("pr_entrada", ColumnType:="Date")> _
        Public Property pr_entrada() As Date
            Get
                Return _pr_entrada
            End Get
            Set(ByVal value As Date)
                _pr_entrada = value
            End Set
        End Property

        <[Property]("pr_saida", ColumnType:="Date")> _
        Public Property pr_saida() As Date
            Get
                Return _pr_saida
            End Get
            Set(ByVal value As Date)
                _pr_saida = value
            End Set
        End Property

        <[Property]("pr_inativo")> _
        Public Property pr_inativo() As Short
            Get
                Return _pr_inativo
            End Get
            Set(ByVal value As Short)
                _pr_inativo = value
            End Set
        End Property

        <[Property]("pr_peso_bruto")> _
        Public Property pr_peso_bruto() As Decimal
            Get
                Return _pr_peso_bruto
            End Get
            Set(ByVal value As Decimal)
                _pr_peso_bruto = value
            End Set
        End Property

        <[Property]("pr_peso_liquido")> _
        Public Property pr_peso_liquido() As Decimal
            Get
                Return _pr_peso_liquido
            End Get
            Set(ByVal value As Decimal)
                _pr_peso_liquido = value
            End Set
        End Property

        <[Property]("pr_foto")> _
        Public Property pr_foto() As String
            Get
                Return _pr_foto
            End Get
            Set(ByVal value As String)
                _pr_foto = value
            End Set
        End Property

        <[Property]("pr_observacao")> _
        Public Property pr_observacao() As String
            Get
                Return _pr_observacao
            End Get
            Set(ByVal value As String)
                _pr_observacao = value
            End Set
        End Property

        <[Property]("pr_tipo")> _
        Public Property pr_tipo() As Short
            Get
                Return _pr_tipo
            End Get
            Set(ByVal value As Short)
                _pr_tipo = value
            End Set
        End Property

        <[Property]("pr_num_item")> _
        Public Property pr_num_item() As Short
            Get
                Return _pr_num_item
            End Get
            Set(ByVal value As Short)
                _pr_num_item = value
            End Set
        End Property

        <[Property]("pr_aliq_ii")> _
        Public Property pr_aliq_ii() As Decimal
            Get
                Return _pr_aliq_ii
            End Get
            Set(ByVal value As Decimal)
                _pr_aliq_ii = value
            End Set
        End Property


        <[Property]("pr_ipi_tipo_calc")> _
        Public Property pr_ipi_tipo_calc() As Integer
            Get
                Return _pr_ipi_tipo_calc
            End Get
            Set(ByVal value As Integer)
                _pr_ipi_tipo_calc = value
            End Set
        End Property
        <[Property]("pr_aliq_ipi")> _
        Public Property pr_aliq_ipi() As Decimal
            Get
                Return _pr_aliq_ipi
            End Get
            Set(ByVal value As Decimal)
                _pr_aliq_ipi = value
            End Set
        End Property
        <[Property]("pr_ipi_vlr_unit")> _
        Public Property pr_ipi_vlr_unit() As Decimal
            Get
                Return _pr_ipi_vlr_unit
            End Get
            Set(ByVal value As Decimal)
                _pr_ipi_vlr_unit = value
            End Set
        End Property


        <[Property]("pr_pis_tipo_calc")> _
        Public Property pr_pis_tipo_calc() As Integer
            Get
                Return _pr_pis_tipo_calc
            End Get
            Set(ByVal value As Integer)
                _pr_pis_tipo_calc = value
            End Set
        End Property
        <[Property]("pr_aliq_pis")> _
        Public Property pr_aliq_pis() As Decimal
            Get
                Return _pr_aliq_pis
            End Get
            Set(ByVal value As Decimal)
                _pr_aliq_pis = value
            End Set
        End Property
        <[Property]("pr_pis_vlr_unit")> _
        Public Property pr_pis_vlr_unit() As Decimal
            Get
                Return _pr_pis_vlr_unit
            End Get
            Set(ByVal value As Decimal)
                _pr_pis_vlr_unit = value
            End Set
        End Property


        <[Property]("pr_pisst_tipo_calc")> _
        Public Property pr_pisst_tipo_calc() As Integer
            Get
                Return _pr_pisst_tipo_calc
            End Get
            Set(ByVal value As Integer)
                _pr_pisst_tipo_calc = value
            End Set
        End Property
        <[Property]("pr_aliq_pis_st")> _
        Public Property pr_aliq_pis_st() As Decimal
            Get
                Return _pr_aliq_pis_st
            End Get
            Set(ByVal value As Decimal)
                _pr_aliq_pis_st = value
            End Set
        End Property
        <[Property]("pr_pisst_vlr_unit")> _
        Public Property pr_pisst_vlr_unit() As Decimal
            Get
                Return _pr_pisst_vlr_unit
            End Get
            Set(ByVal value As Decimal)
                _pr_pisst_vlr_unit = value
            End Set
        End Property

        <[Property]("pr_cofins_tipo_calc")> _
        Public Property pr_cofins_tipo_calc() As Integer
            Get
                Return _pr_cofins_tipo_calc
            End Get
            Set(ByVal value As Integer)
                _pr_cofins_tipo_calc = value
            End Set
        End Property
        <[Property]("pr_aliq_cofins")> _
        Public Property pr_aliq_cofins() As Decimal
            Get
                Return _pr_aliq_cofins
            End Get
            Set(ByVal value As Decimal)
                _pr_aliq_cofins = value
            End Set
        End Property
        <[Property]("pr_cofins_vlr_unit")> _
        Public Property pr_cofins_vlr_unit() As Decimal
            Get
                Return _pr_cofins_vlr_unit
            End Get
            Set(ByVal value As Decimal)
                _pr_cofins_vlr_unit = value
            End Set
        End Property

        <[Property]("pr_cofinsst_tipo_calc")> _
                Public Property pr_cofinsst_tipo_calc() As Integer
            Get
                Return _pr_cofinsst_tipo_calc
            End Get
            Set(ByVal value As Integer)
                _pr_cofinsst_tipo_calc = value
            End Set
        End Property
        <[Property]("pr_aliq_cofins_st")> _
        Public Property pr_aliq_cofins_st() As Decimal
            Get
                Return _pr_aliq_cofins_st
            End Get
            Set(ByVal value As Decimal)
                _pr_aliq_cofins_st = value
            End Set
        End Property
        <[Property]("pr_cofinsst_vlr_unit")> _
        Public Property pr_cofinsst_vlr_unit() As Decimal
            Get
                Return _pr_cofinsst_vlr_unit
            End Get
            Set(ByVal value As Decimal)
                _pr_cofinsst_vlr_unit = value
            End Set
        End Property

        <[Property]("pr_aliq_icms_red")> _
        Public Property pr_aliq_icms_red() As Decimal
            Get
                Return _pr_aliq_icms_red
            End Get
            Set(ByVal value As Decimal)
                _pr_aliq_icms_red = value
            End Set
        End Property

        <[Property]("pr_aliq_icms")> _
        Public Property pr_aliq_icms() As Decimal
            Get
                Return _pr_aliq_icms
            End Get
            Set(ByVal value As Decimal)
                _pr_aliq_icms = value
            End Set
        End Property

        <[Property]("pr_aliq_icms_st_red")> _
        Public Property pr_aliq_icms_st_red() As Decimal
            Get
                Return _pr_aliq_icms_st_red
            End Get
            Set(ByVal value As Decimal)
                _pr_aliq_icms_st_red = value
            End Set
        End Property

        <[Property]("pr_aliq_icms_st")> _
        Public Property pr_aliq_icms_st() As Decimal
            Get
                Return _pr_aliq_icms_st
            End Get
            Set(ByVal value As Decimal)
                _pr_aliq_icms_st = value
            End Set
        End Property

        <[Property]("pr_aliq_issqn")> _
        Public Property pr_aliq_issqn() As Decimal
            Get
                Return _pr_aliq_issqn
            End Get
            Set(ByVal value As Decimal)
                _pr_aliq_issqn = value
            End Set
        End Property

        <[Property]("pr_cst")> _
        Public Property pr_cst() As String
            Get
                Return _pr_cst
            End Get
            Set(ByVal value As String)
                _pr_cst = value
            End Set
        End Property

        <[Property]("pr_embalagem")> _
        Public Property pr_embalagem() As String
            Get
                Return _pr_embalagem
            End Get
            Set(ByVal value As String)
                _pr_embalagem = value
            End Set
        End Property

        <HasMany(GetType(Nfitem), Table:="nfitem", ColumnKey:="cd_produto", Inverse:=True, Lazy:=True)> _
        Public Property Nfitem() As IList(Of Model.Nfitem)
            Get
                Return _Nfitems
            End Get
            Set(ByVal value As IList(Of Model.Nfitem))
                _Nfitems = value
            End Set
        End Property

        <HasMany(GetType(Model.Estoque), Table:="estoque", Columnkey:="cd_produto", Lazy:=True)> _
        Public Property Estoques() As IList(Of Model.Estoque)
            Get
                Return _Estoques
            End Get
            Set(ByVal value As IList(Of Model.Estoque))
                _Estoques = value
            End Set
        End Property

    End Class
End Namespace